<template>
  <div class="head">
    <el-form ref="searchForm" :model="search" @submit.native.prevent>
      <el-form-item>
        <el-input
          v-model="search.content"
          @keyup.enter.native="onSubmitSearch"
        ></el-input>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmitSearch">查询</el-button>
      </el-form-item>
      <el-form-item>
        <el-button type="primary" @click="onSubmitAdd">添加</el-button>
      </el-form-item>
    </el-form>
  </div>
</template>

<script>
export default {
  data(){
    return {
      search:{
        content:''
      }
    }
  },
  methods:{
    onSubmitSearch(){
      //查询按钮 通知list 页面需要查询 让list页面渲染出查询的内容
      this.$bus.$emit('onSearch',this.search.content)
    },
    onSubmitAdd(){
      //添加按钮
      this.$bus.$emit('onAddDialog',true)
    }
  }
}
</script>

<style scoped lang="less">
.el-form{
  overflow: hidden;
  clear: both;
  display: flex;
  .el-form-item{
    float: left;
    margin-right:10px ;
    .el-input{
      width:1025px;
    }
  }
}
.head{
  margin-top: 20px;
  width: 100%;
}
</style>